/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.cooperativa.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author giovanny
 */
@Entity
@Table(name = "transaccion_detalle")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TransaccionDetalle.findAll", query = "SELECT t FROM TransaccionDetalle t"),
    @NamedQuery(name = "TransaccionDetalle.findById", query = "SELECT t FROM TransaccionDetalle t WHERE t.id = :id"),
    @NamedQuery(name = "TransaccionDetalle.findByCantidad", query = "SELECT t FROM TransaccionDetalle t WHERE t.cantidad = :cantidad"),
    @NamedQuery(name = "TransaccionDetalle.findByMonto", query = "SELECT t FROM TransaccionDetalle t WHERE t.monto = :monto"),
    
    @NamedQuery(name = "TransaccionDetalle.findByTransaccionId", query = "SELECT t FROM TransaccionDetalle t WHERE t.idTransaccion = :idTransaccion"),
    
    @NamedQuery(name = "TransaccionDetalle.findByCreationDate", query = "SELECT t FROM TransaccionDetalle t WHERE t.creationDate = :creationDate"),
    @NamedQuery(name = "TransaccionDetalle.findByCreatedBy", query = "SELECT t FROM TransaccionDetalle t WHERE t.createdBy = :createdBy"),
    @NamedQuery(name = "TransaccionDetalle.findByLastUpdateDate", query = "SELECT t FROM TransaccionDetalle t WHERE t.lastUpdateDate = :lastUpdateDate"),
    @NamedQuery(name = "TransaccionDetalle.findByLastUpdateBy", query = "SELECT t FROM TransaccionDetalle t WHERE t.lastUpdateBy = :lastUpdateBy"),
    @NamedQuery(name = "TransaccionDetalle.findByFechaTransaccion", query = "SELECT t FROM TransaccionDetalle t WHERE t.fechaTransaccion = :fechaTransaccion")})
public class TransaccionDetalle implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "cantidad")
    private int cantidad;
    @Basic(optional = false)
    @NotNull
    @Column(name = "monto")
    private float monto;
    @Basic(optional = false)
    @NotNull
    @Column(name = "creation_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date creationDate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "created_by")
    private int createdBy;
    @Column(name = "last_update_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date lastUpdateDate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "last_update_by")
    private int lastUpdateBy;
    @Basic(optional = false)
    @NotNull
    @Column(name = "fecha_transaccion")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaTransaccion;
    @JoinColumn(name = "id_unidad", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Unidad idUnidad;
    @JoinColumn(name = "id_transaccion", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Transaccion idTransaccion;
    @JoinColumn(name = "id_tipo_pago", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private TipoPago idTipoPago;
//    @JoinColumn(name = "id_socio", referencedColumnName = "id")
//    @ManyToOne(optional = false)
//    private Socio idSocio;

    public TransaccionDetalle() {
    }

    public TransaccionDetalle(Integer id) {
        this.id = id;
    }

    public TransaccionDetalle(Integer id, int cantidad, float monto, Date creationDate, int createdBy, int lastUpdateBy, Date fechaTransaccion) {
        this.id = id;
        this.cantidad = cantidad;
        this.monto = monto;
        this.creationDate = creationDate;
        this.createdBy = createdBy;
        this.lastUpdateBy = lastUpdateBy;
        this.fechaTransaccion = fechaTransaccion;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public int getCantidad() {
        return cantidad;
    }

    public void setCantidad(int cantidad) {
        this.cantidad = cantidad;
    }

    public float getMonto() {
        return monto;
    }

    public void setMonto(float monto) {
        this.monto = monto;
    }

    public Date getCreationDate() {
        return creationDate;
    }

    public void setCreationDate(Date creationDate) {
        this.creationDate = creationDate;
    }

    public int getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(int createdBy) {
        this.createdBy = createdBy;
    }

    public Date getLastUpdateDate() {
        return lastUpdateDate;
    }

    public void setLastUpdateDate(Date lastUpdateDate) {
        this.lastUpdateDate = lastUpdateDate;
    }

    public int getLastUpdateBy() {
        return lastUpdateBy;
    }

    public void setLastUpdateBy(int lastUpdateBy) {
        this.lastUpdateBy = lastUpdateBy;
    }

    public Date getFechaTransaccion() {
        return fechaTransaccion;
    }

    public void setFechaTransaccion(Date fechaTransaccion) {
        this.fechaTransaccion = fechaTransaccion;
    }

    public Unidad getIdUnidad() {
        return idUnidad;
    }

    public void setIdUnidad(Unidad idUnidad) {
        this.idUnidad = idUnidad;
    }

    public Transaccion getIdTransaccion() {
        return idTransaccion;
    }

    public void setIdTransaccion(Transaccion idTransaccion) {
        this.idTransaccion = idTransaccion;
    }

    public TipoPago getIdTipoPago() {
        return idTipoPago;
    }

    public void setIdTipoPago(TipoPago idTipoPago) {
        this.idTipoPago = idTipoPago;
    }

//    public Socio getIdSocio() {
//        return idSocio;
//    }
//
//    public void setIdSocio(Socio idSocio) {
//        this.idSocio = idSocio;
//    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TransaccionDetalle)) {
            return false;
        }
        TransaccionDetalle other = (TransaccionDetalle) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cooperativa.entities.TransaccionDetalle[ id=" + id + " ]";
    }
    
}
